#!/bin/bash

export CUDA_VISIBLE_DEVICES=2,3

# 明确列出要遍历的文件（直接拷贝你给的）
file_list=(
  checkpoint-1000.jsonl  checkpoint-1700.jsonl  checkpoint-400.jsonl        full_checkpoint-300.jsonl
  checkpoint-100.jsonl   checkpoint-1800.jsonl  checkpoint-500.jsonl        full_checkpoint-600.jsonl
  checkpoint-1100.jsonl  checkpoint-1900.jsonl  checkpoint-600.jsonl        full_checkpoint-900.jsonl
  checkpoint-1200.jsonl  checkpoint-2000.jsonl  checkpoint-700.jsonl        full_last.jsonl
  checkpoint-1300.jsonl  checkpoint-200.jsonl   checkpoint-800.jsonl        generated_predictions.jsonl
  checkpoint-1400.jsonl  checkpoint-2100.jsonl  checkpoint-900.jsonl
  checkpoint-1500.jsonl  checkpoint-2160.jsonl  full_checkpoint-1200.jsonl
  checkpoint-1600.jsonl  checkpoint-300.jsonl   full_checkpoint-1285.jsonl
)

for file in "${file_list[@]}"; do
  # 拼接路径
  adapter_path="experiments/med_pub_out/${file}"
  # 拼接保存路径
  save_name="experiments/eval_med_pub/wrong_case_${file}"
  
  echo "Running ${file} ..."
  
  python -u /home/gy/work/framework/LLaMA-Factory/scripts/vllm_infer.py \
    --model_name_or_path ./pretrained/Qwen2.5-VL-3B-Instruct \
    --adapter_name_or_path "${adapter_path}" \
    --dataset med_pub_test \
    --dataset_dir experiments/med_pub_data \
    --template qwen2_vl \
    --save_name "${save_name}"
  
  # 检查返回值
  if [ $? -ne 0 ]; then
    echo "Error running ${file}!"
    exit 1
  fi
done
